<template>
    <rx-dialog @handOk="onOk" @cancel="onCancel">
        <rx-layout>
            <div slot="center">
                <rx-grid
                        ref="table"
                        :columns="columns"
                        :dataSource="dataSource"
                        :bordered="true"
                        :allowRowSelect="true"
                        :multiSelect="false"
                        :showPage="false"
                        style="height:450px;"
                >
                </rx-grid>
            </div>
        </rx-layout>
    </rx-dialog>
</template>

<script>
    import {RxLayout, Util,RxDialog,RxGrid} from "@lowcode/jpaas-common-lib";
    import FormBoListApi from "@/api/form/core/formBoList";

    export default {
        name: "importDataHandlerDialog",
        components:{
            RxDialog,
            RxLayout,
            RxGrid
        },
        props:{
            layerid: String,
            destroy:Function
        },
        data(){
            return {
                dataSource:[],
                columns:[{title: this.i18n('processorName','处理器名称'), dataIndex: 'label', width: 100},
                    {title: this.i18n('className','类名称'), dataIndex: 'value', width: 120}]
            }
        },
        created() {
            FormBoListApi.getImportDataHandlers().then(res=>{
                this.dataSource=res;
            }).catch(res=>{
                console.log(res);
            })
        },
        methods:{
            i18n(name,text,key){
                return this.$ti18(name,text,"formBoListDialog",key);
            },
            onOk(){
                var node=this.$refs.table.getSelectedRow();
                Util.closeWindow(this,'ok',node);
            },
            onCancel(){
                Util.closeWindow(this,'cancel');
            }
        }
    }
</script>

<style scoped>

</style>